-
Notifications
You must be signed in to change notification settings - Fork 275
/
index.ts
28 lines (23 loc) · 1.14 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { AdaptiveDialog, OnIntent, CancelAllDialogs, TextInput, EditArray, ArrayChangeType, SendActivity, IfCondition, SetProperty } from "botbuilder-dialogs-adaptive";
import { getRecognizer } from "../recognizer";
export class AddToDo extends AdaptiveDialog {
constructor() {
super('AddToDo', [
new TextInput('$title', '@title', `What would you like to call your new todo?`),
new EditArray(ArrayChangeType.push, 'user.todos', '$title'),
new SendActivity(`Added a todo named "{$title}". You can delete it by saying "delete todo named {$title}".`),
new IfCondition(`user.tips.showToDos != true`, [
new SendActivity(`To view your todos just ask me to "show my todos".`),
new SetProperty('user.tips.showToDos', 'true')
])
]);
// Use parents recognizer
this.recognizer = getRecognizer();
// Add interruption rules
this.addRule(new OnIntent('#Cancel', [], [
new CancelAllDialogs('cancelAdd')
]));
}
}